package model;

import java.util.ArrayList;
import java.util.Date;

import model.enums.StayType;
import model.enums.TrainingType;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Order;

public class Stay extends Model
{
	private Employee		employee;
	private StayType		stayType;
	private TrainingType	trainingType;
	private Date			start;
	private Date			end;
	private String			comment;
	private Location		location;

	public Stay()
	{

	}

	@SuppressWarnings("unchecked")
	public static ArrayList<Stay> getAllStaysDescByStartEnd(Session session)
	{
		Criteria criteria = session.createCriteria(Stay.class);
		criteria.addOrder(Order.desc("start"));
		criteria.addOrder(Order.desc("end"));
		return (ArrayList<Stay>) criteria.list();
	}

	public Employee getEmployee()
	{
		return employee;
	}

	public void setEmployee(Employee employee)
	{
		this.employee = employee;
	}

	public StayType getStayType()
	{
		return stayType;
	}

	public void setStayType(StayType stayType)
	{
		this.stayType = stayType;
	}

	public TrainingType getTrainingType()
	{
		return trainingType;
	}

	public void setTrainingType(TrainingType trainingType)
	{
		this.trainingType = trainingType;
	}

	public Date getStart()
	{
		return start;
	}

	public void setStart(Date start)
	{
		this.start = start;
	}

	public Date getEnd()
	{
		return end;
	}

	public void setEnd(Date end)
	{
		this.end = end;
	}

	public String getComment()
	{
		return comment;
	}

	public void setComment(String comment)
	{
		this.comment = comment;
	}

	public Location getLocation()
	{
		return location;
	}

	public void setLocation(Location location)
	{
		this.location = location;
	}
}
